package com.hk.commons.entity;

import java.math.BigDecimal;

import javax.persistence.Entity;
import javax.persistence.Id;
import javax.persistence.Table;

 
	
@Entity
@Table(name = "t_user_extra_info")
public class UserExtraInfo implements java.io.Serializable {

	
	private static final long serialVersionUID = 6819255102671461153L;

	@Id
	private Long id;
	
	/** 用户id **/
	private Long userId;
	
	/** 用户获得的积分**/
	private Integer totalPoints = 0;
	
	/** 用户已使用的积分**/
	private Integer usedPoints = 0;
	
	/** 推荐客户总人数**/
	private Integer relationUserAmount = 0;
	
	/** 客户绑卡数 **/
	private Integer tieCardAmount = 0;
	
	/** 客户预约数 **/
	private Integer bespeakOrderAmount = 0;
	
	/** 客户付款订单总金额 **/
	private BigDecimal payOrderMoney = new BigDecimal(0);
	
	/** 客户下单数 **/
	private Integer payOrderAmount = 0;
	
	private Long cts;

	public Long getId() {
		return id;
	}

	public void setId(Long id) {
		this.id = id;
	}

	public Long getUserId() {
		return userId;
	}

	public void setUserId(Long userId) {
		this.userId = userId;
	}
	
	public Integer getTieCardAmount() {
		return tieCardAmount;
	}

	public void setTieCardAmount(Integer tieCardAmount) {
		this.tieCardAmount = tieCardAmount;
	}

	public Integer getBespeakOrderAmount() {
		return bespeakOrderAmount;
	}

	public void setBespeakOrderAmount(Integer bespeakOrderAmount) {
		this.bespeakOrderAmount = bespeakOrderAmount;
	}

	public Integer getPayOrderAmount() {
		return payOrderAmount;
	}

	public void setPayOrderAmount(Integer payOrderAmount) {
		this.payOrderAmount = payOrderAmount;
	}

	public Integer getRelationUserAmount() {
		return relationUserAmount;
	}

	public void setRelationUserAmount(Integer relationUserAmount) {
		this.relationUserAmount = relationUserAmount;
	}

	public Long getCts() {
		return cts;
	}

	public void setCts(Long cts) {
		this.cts = cts;
	}
	
	private void addTotalPoints(Integer points){
		if(this.getTotalPoints() == null){
			this.totalPoints = 0;
		}
		
		this.totalPoints = this.totalPoints + points;
	}

	public Integer getUsedPoints() {
		return usedPoints;
	}

	public void setUsedPoints(Integer usedPoints) {
		this.usedPoints = usedPoints;
	}
	
	private void addUsedPoints(Integer points){
		if(this.getUsedPoints() == null){
			this.usedPoints = 0;
		}
		
		this.usedPoints = this.usedPoints + points;
	}

	public Integer getTotalPoints() {
		return totalPoints;
	}

	public void setTotalPoints(Integer totalPoints) {
		this.totalPoints = totalPoints;
	}
	
	public Integer getLeftPoints(){
		return this.totalPoints - this.usedPoints;
	}
	
	public void addPoints(Integer points){
		if(points <0){
			this.addUsedPoints(points * (-1));
		}else{
			this.addTotalPoints(points);
		}
		
	}

	public BigDecimal getPayOrderMoney() {
		return payOrderMoney;
	}

	public void setPayOrderMoney(BigDecimal payOrderMoney) {
		this.payOrderMoney = payOrderMoney;
	}
	
}
